package D12_19z.BU_6;

import java.lang.reflect.Field;
import java.util.Map;

public class MyBeanUtils {
    public static void populate(Object obj, Map<String,String[]> map)  {
        try {
            for (Map.Entry<String, String[]> entry : map.entrySet()) {
                Class<?> aClass = obj.getClass();
                Field d = aClass.getDeclaredField(entry.getKey());
                d.setAccessible(true);
                if (entry.getValue().length==1){
                    d.set(obj,entry.getValue()[0]);
                }else {
                    d.set(obj,entry.getValue());
                }
            }
        }catch (Exception e){

        }
    }
}
